package hlhj.fhp.burst.activitys

import android.os.Bundle
import android.support.v4.view.ViewPager
import com.google.gson.Gson
import com.tenma.ventures.base.TMActivity
import hlhj.fhp.burst.R
import hlhj.fhp.burst.adapter.PreViewAdpBurst
import kotlinx.android.synthetic.main.aty_preview_burst.*

/**
 * Created by Never Fear   on 2019\1\29 0029.
Never More....
 */
class PreviewAtyBurst :TMActivity(){
    private var previewAdp:PreViewAdpBurst?=null
    private val datas=ArrayList<String>()

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.aty_preview_burst)
        previewAdp= PreViewAdpBurst(datas,this)
        viewPager.adapter=previewAdp

        val extra = intent.getStringArrayListExtra("imgs")
        datas.addAll(extra)
        previewAdp?.notifyDataSetChanged()

        itemPro.text= "1 / ${datas.size}"

        viewPager?.addOnPageChangeListener(object :ViewPager.OnPageChangeListener{
            override fun onPageScrollStateChanged(state: Int) {

            }

            override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
            }
            override fun onPageSelected(position: Int) {
                itemPro.text= "${position+1} / ${datas.size}"
            }
        })
    }
}